<!-- 首页-组件模板 -->
<template>
	<view class="homeDoms">
		<!-- 广告图 -->
		<view class="adDoms">
			<image src="/static/home/bn.png" mode="widthFix"></image>
			<view class="adTexts flexDom alignItems">
				<view class="flexOne marginRight20">
					<view class="flexDom alignItems marginBottom20">
						<text class="marginRight10">仙儿按摩馆</text>
						<image src="/static/home/mendian.png" mode="widthFix" style="width: 65px;"></image>
					</view>
					<view class=" marginBottom20">
						营业时间：24小时营业
					</view>
					<view>
						门店位置：全国连锁，全国均可小程序提前预约到店享受服务
					</view>
				</view>
				<view class="textAlign" @click="callPhone('19567324561')">
					<image class="marginBottom10" src="/static/home/phone.png" mode="widthFix" style="width: 60px;"></image>
					<view class="fontSize12">致电商家</view>
				</view>
			</view>
		</view>
		
		<!-- 项目列表-内容 -->
		<view class="listDoms">
			<view v-for="(item, index) in list" :class="index==3?'paddingBottom20':'bordrBottom666 marginBottom30 paddingBottom30'">
				<view class="flexDom marginBottom20">
					<view class="marginRight20 flexDom alignItems">
						<image v-if="index==0" class="xmDoms" src="/static/home/xm1.jpg" mode="widthFix"></image>
						<image v-if="index==1" class="xmDoms" src="/static/home/xm2.jpg" mode="widthFix"></image>
						<image v-if="index==2" class="xmDoms" src="/static/home/xm3.jpg" mode="widthFix"></image>
						<image v-if="index==3" class="xmDoms" src="/static/home/xm4.jpg" mode="widthFix"></image>
					</view>
					<view class="flexOne">
						<view class="flexDom marginBottom20">
							<text class="xmTitle">{{item.name}}</text>
						</view>
						<view class="marginBottom20 fontWeight">{{item.desc}}</view>
						<view class="flexDom mainColor"> 
							<view>
								<text class="fontSize18 marginRight10">￥{{item.price}}</text>
								<text class="marginRight10">{{item.time}}</text>
							</view>
							<view class="flexOne textRight">
								<text class="xmBtton" @click="toNavigateTo('/pages/reservation/index?id='+item.id)">立即预约</text>
							</view>
						</view>
					</view>
				</view>
				
			</view>
		</view>
		
	</view>
</template>

<!-- 组件核心js -->
<script>
	export default {
		data() {
			return {
				list: [
					{id:1, name: '中式按摩', desc: "缓解疲劳 改善睡眠", price: 218, time: '60分钟', serversNums: 1262},
					{id:2, name: '通络培元', desc: "缓解疲劳 疏通经络", price: 298, time: '80分钟', serversNums: 3153},
					{id:3, name: '泰式SPA', desc: "消除疲劳 提高免疫", price: 398, time: '120分钟', serversNums: 5270},
					{id:4, name: '法式SPA', desc: "疏通经络 放松身心", price: 498, time: '120分钟', serversNums: 170}
				]
			};
		},
		methods: {
			/**
			 * 跳转-其它非tab菜单
			 * */
			toNavigateTo(url) {
				uni.navigateTo({
					url: url
				})
			},
			
			/**
			 * 拨打电话-函数
			 * */
			callPhone(phone) {
				uni.makePhoneCall({
					phoneNumber: phone
				});
			}
		}
	}
</script>

<!-- 当前页面css -->
<style lang="scss" scoped>
	page{
		background: #f8f8f8;
	}
	.homeDoms {
		margin: 40upx 30upx;
		.flexDom{
			display: flex;
		}
		.flexOne {
			flex: 1;
		}
		.alignItems {
			align-items: center;
		}
		.fontSize12 {
			font-size: 24upx;
		}
		.fontSize18 {
			font-size: 36upx;
		}
		.fontWeight {
			font-weight: bold;
		}
		.colorWhite{
			color: #FFFFFF;
		}
		.color666{
			color: #666666;
		}
		.color999{
			color: #999999;
		}
		.textAlign{
			text-align: right;
		}
		.textRight {
			text-align: right;
		}
		.mainColor{
			color: #7c89d9;
		}
		.bordrBottom666{
			border-bottom: 1px solid #666666;
		}
		.paddingBottom20{
			padding-bottom: 20upx;
		}
		.paddingBottom30{
			padding-bottom: 30upx;
		}
		.marginBottom20 {
			margin-bottom: 20upx;
		}
		.marginBottom30 {
			margin-bottom: 30upx;
		}
		.marginRight10 {
			margin-right: 10upx;
		}
		.marginRight20 {
			margin-right: 20upx;
		}
		.adDoms {
			background: #FFFFFF;
			margin-bottom: 40upx;
			border-radius: 20upx;
			image {
				width: 100%;
				border-radius: 20upx;
			}
			.adTexts {
				padding: 20upx 20upx 30upx;
			}
		}
		.xmBtton {
			display: inline-block;
			background: #7c89d9;
			font-size: 30upx;
			color: #FFFFFF;
			padding: 15upx 40upx;
			border-radius: 40upx;
		}
		.listDoms {
			background: #FFFFFF;
			border-radius: 20upx;
			padding: 30upx 20upx;
			.xmDoms {
				width: 180upx;
			}
			.xmTitle {
				font-size: 36upx;
				font-weight: bold;
				padding: 15upx 40upx 15upx 0;
				border-radius: 0 40upx 40upx 0;
				margin-right: 20upx;
			}
			.mainBg {
				display: inline-block;
				background: #7c89d9;
				padding: 10upx;
				font-size: 24upx;
				border-radius: 15upx;
			}
		}
	}
</style>
